home *** CD-ROM | disk | FTP | other *** search
/ 220 Jogos / 220 jogos.iso / classicos / resta11 / SEndScene.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-12-24  |  3.1 KB  |  182 lines

  1. // SEndScene.cpp: Implementierung der Klasse SEndScene.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4.  
  5. #include "stdafx.h"
  6. #include "stdafx.h"
  7. #include "SEndScene.h"
  8.  
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char THIS_FILE[]=__FILE__;
  12. #define new DEBUG_NEW
  13. #endif
  14.  
  15. #define SIZE_SPEED 0.0003f
  16. #define DONE_SPEED 0.0005f
  17. #define TEXT_SPEED 0.0005f
  18.  
  19. //////////////////////////////////////////////////////////////////////
  20. // Konstruktion/Destruktion
  21. //////////////////////////////////////////////////////////////////////
  22.  
  23. SEndScene::SEndScene()
  24. {
  25.     state = TEXT_DONE;
  26.     number = 0;
  27.     size[0] = 0.15f;
  28.     size[1] = 1.0f;
  29.     done = false;
  30.     position = 10.0f;
  31. }
  32.  
  33. SEndScene::~SEndScene()
  34. {
  35.  
  36. }
  37.  
  38. void SEndScene::create(HDC hDC,int howmany)
  39. {
  40.     font.createFont(hDC,"Arial",36,0.0f,SFontAttri(800,false,false));
  41.     number = howmany;
  42. }
  43.  
  44. void SEndScene::update(float frametime)
  45. {
  46.     glDisable(GL_TEXTURE_2D);
  47.  
  48.     if (state == TEXT_DONE)
  49.     {
  50.         CString text;
  51.  
  52.         if (number <= 2)
  53.         {
  54.             text = "Super! Fast Perfekt!";
  55.         }
  56.         else if (number <= 4)
  57.         {
  58.             text = "Sehr gut!";
  59.         }
  60.         else if (number <= 6)
  61.         {
  62.             text = "Na ja geht auch besser!";
  63.         }
  64.         else if (number <= 8)
  65.         {
  66.             text = "Das Resultat ⁿberseh ich mal...";
  67.         }
  68.         else 
  69.         {
  70.             text = "Pfff! Da sind ja 90-JΣhrige besser!";
  71.         }
  72.  
  73.         size[0] += SIZE_SPEED*frametime;
  74.         size[1] += DONE_SPEED*frametime;
  75.  
  76.         glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  77.  
  78.         
  79.         //*****************
  80.  
  81.         glPushMatrix();
  82.  
  83.         glTranslatef(0.0f,-1.5f,-8.0f);
  84.         glScalef(size[0],size[0],1.0f);
  85.         
  86.         glColor3f(1.0f,1.0f,1.0f);
  87.  
  88.         font.drawText(CENTER,text);
  89.         
  90.         glPopMatrix();
  91.  
  92.         //***************
  93.  
  94.         glPushMatrix();
  95.  
  96.         glTranslatef(0.0f,0.0f,-8.0f);
  97.         glScalef(size[1],size[1],1.0f);
  98.  
  99.         glEnable(GL_BLEND);
  100.         glDisable(GL_DEPTH_TEST);
  101.  
  102.  
  103.         glColor4f(1.0f,1.0f,1.0f,0.5f);
  104.  
  105.         
  106.         font.drawText(CENTER,"Geschafft");
  107.  
  108.         glDisable(GL_BLEND);
  109.         glEnable(GL_DEPTH_TEST);
  110.  
  111.         glPopMatrix();
  112.  
  113.  
  114.         glBlendFunc(GL_ONE,GL_ONE);
  115.  
  116.         if (size[0] >= 3.5f)
  117.         {
  118.             state = TEXT_MC;
  119.         }
  120.     }
  121.     else if (state == TEXT_MC)
  122.     {
  123.         glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
  124.  
  125.         
  126.  
  127.         //*******************************************
  128.         //TEXT
  129.  
  130.         glPushMatrix();
  131.  
  132.         position -= TEXT_SPEED*frametime;
  133.  
  134.         glTranslatef(position,-0.5f,-5.0f);
  135.         glScalef(2.0f,2.0f,1.0f);
  136.  
  137.         glColor3f(1.0f,1.0f,1.0f);
  138.         font.drawText(CENTER,"MERRY CHRISTMAS!!!");
  139.  
  140.         glPopMatrix();
  141.         
  142.         //***************************
  143.         //Schwarzfaden
  144.         
  145.         glPushMatrix();
  146.  
  147.         glTranslatef(0.0f,0.0f,-5.0f);
  148.  
  149.         glDisable(GL_DEPTH_TEST);
  150.         glEnable(GL_BLEND);
  151.         
  152.         glBegin(GL_QUADS);
  153.             glColor4f(0.0f,0.0f,0.0f,0.0f);
  154.             glVertex3f(0.0f,10.0f,0.0f);
  155.             glColor4f(0.0f,0.0f,0.0f,0.0f);
  156.             glVertex3f(0.0f,-10.0f,0.0f);
  157.             glColor4f(0.0f,0.0f,0.0f,1.0f);
  158.             glVertex3f(0.0f,-10.0f,0.0f);
  159.             glColor4f(0.0f,0.0f,0.0f,1.0f);
  160.             glVertex3f(20.0f,-10.0f,0.0f);
  161.         glEnd();
  162.         
  163.         glDisable(GL_BLEND);
  164.         glEnable(GL_DEPTH_TEST);
  165.  
  166.         glBlendFunc(GL_ONE,GL_ONE);
  167.  
  168.         if (position < -15.0f)
  169.         {
  170.             done = true;
  171.         }
  172.         
  173.     }
  174.     
  175.     glEnable(GL_TEXTURE_2D);
  176. }
  177.  
  178. bool SEndScene::isDone()
  179. {
  180.     return done;
  181. }
  182.